<?php
/* @var $this AnalysisController */

//当前商家的优惠券
$criteria=new CDbCriteria;
$criteria->compare('zti_status',1);
$criteria->compare('zti_start_time','<'.time());
$criteria->compare('zti_end_time','>'.time());
$criteria->compare('zti_inventory','>0');
$criteria->compare('zm_id',Company::model()->getCmpUserId());
$ticket = Ticket::model()->findAll($criteria);
$ticket = CHtml::listData($ticket,'zti_id','zti_title');

?>

<?php if(empty($model)){?>
<div class="no_meetgive bd_db ff_s">
	<span class="ico ico_tip"></span>还未创建“满就送”活动，现在去
	<?php echo CHtml::link(Yii::t('cmp','Create Promotion'),array('createMeetgive'),array('class'=>'mem_btn mem_btn20'));?>
</div>
<?php }else{?>


<div class="view_meetgive meetgive form_done bd_db ">	
	<?php foreach($model as $val){ ?>
	<ul class="form_list form_list2">
		<li class="c_f"><span class="tit">活动名称：</span>
			<div class="cont f_l"><?php echo CHtml::encode($val->zcr_title)?></div>
		</li>
		<li class="c_f"><span class="tit">活动时间：</span>
			<div class="cont f_l"><?php echo date('Y/m/d',$val->zcr_start_time)?>至<?php echo date('Y/m/d',$val->zcr_end_time)?></div>
		</li>
		<li class="c_f"><span class="tit">活动状态：</span>
			<div class="cont f_l"><?php echo ($val->zcr_status==2)?"已停止":"进行中" ?></div>
		</li>
		<li class="c_f"><span class="tit">活动预览：</span>
			<div class="cont f_l activity_view">
				<h3 class="c_f60"><?php echo CHtml::encode($val->zcr_content)?></h3>
				<div class="activity c_f">
					<div class="img f_l"><img src="/images/meetgive_img.gif" alt="" /></div>
					<div class="txt f_l fs_14 line_18">
						<?php //print_r($val->zcr_condition);?>
						<?php if(!empty($val->zcr_condition)){ foreach((array)$val->zcr_condition as $val2 ){?>
							<p><span class="fs_14">买家消费满 <strong class="c_f60"><?php echo $val2['condition']?></strong> 元
								<?php if($val->zcr_type==1){?>
									 减 <strong class="c_f60"><?php echo $val2['value']?></strong> 元 。
								<?php }elseif($val->zcr_type==2){?>
									赠送优惠券：<strong class="c_f60"><?php echo $ticket[$val2['value']]?></strong>
								<?php }?>
							</span></p>
						<?php }}?>
					</div>
				</div>
			</div>
		</li>
		<li class="c_f save_link"><span class="tit">&nbsp;</span>
			<div class="cont f_l">
				<?php echo CHtml::link(Yii::t('cmp','Update Set'),array('updateMeetgive','id'=>$val->zcr_id),array('class'=>'mem_btn mem_btn20 mr5'))?>
				<?php if($val->zcr_status==1||$val->zcr_status==2) echo CHtml::link(($val->zcr_status==2)?Yii::t('cmp','Run'):Yii::t('cmp','Stop'),array('changeMeetgive','id'=>$val->zcr_id),array('class'=>'mem_btn mem_btn08 mr5'))?>
				<?php if($val->zcr_status==2) echo CHtml::link(Yii::t('glo','Delete'),'javascript:',array('class'=>'mem_btn mem_btn08','onclick'=>'return art_del_confirm("'.$this->pre_module_url.'/promotion/deleteMeetgive/id/'.$val->zcr_id.'","你确定要删除这条信息吗？")'))?>
			</div>
		</li>
	</ul>
	<?php } ?>
</div> 

<?php } ?>